package org.lqq.serverRegisterAndFinder.etcd;

import mousio.etcd4j.EtcdClient;
import org.lqq.serverRegisterAndFinder.ServerFinderAndRegister;
import org.lqq.serverRegisterAndFinder.eureka.DefaultServerFinderAndRegister;
import org.lqq.serverRegisterAndFinder.serverFinder.ServerFinder;
import org.lqq.serverRegisterAndFinder.serverFinder.etcd.EtcdServerFinder;
import org.lqq.serverRegisterAndFinder.serverRegister.ServerRegister;
import org.lqq.serverRegisterAndFinder.serverRegister.etcd.EtcdServerRegister;

import java.net.URI;

/**
 * Created by 李清泉 on 2017/11/2.
 *
 * @remark
 */
public class EtcdFactory {

    public static ServerFinderAndRegister create(){
        EtcdClient etcdClient=new EtcdClient(
                URI.create("http://127.0.0.1:2379")
        );
        ServerRegister serverRegister=new EtcdServerRegister(etcdClient);
        ServerFinder serverFinder=new EtcdServerFinder();
        return new DefaultServerFinderAndRegister(serverFinder,serverRegister);
    }
}
